﻿<Window x:Class="XmlDOM.Window1"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:clr="clr-namespace:ICSharpCode.AvalonEdit.Xml;assembly=ICSharpCode.AvalonEdit"
	xmlns:ic="http://icsharpcode.net/sharpdevelop/avalonedit"
	Title="XmlEditor" Height="450" Width="600"
	TextOptions.TextFormattingMode="Display"
	>
	<Window.Resources>
		<Storyboard x:Key="anim">
	        <ColorAnimation Storyboard.TargetProperty="(TextBlock.Background).(SolidColorBrush.Color)" To="Transparent" Duration="0:0:4"/>
	    </Storyboard>
		<HierarchicalDataTemplate DataType="{x:Type clr:AXmlDocument}" ItemsSource="{Binding Elements}">
			<TextBlock Text="XML Document" Margin="2"/>
		</HierarchicalDataTemplate>
		<HierarchicalDataTemplate DataType="{x:Type clr:AXmlElement}" ItemsSource="{Binding AttributesAndElements}">
			<TextBlock Text="{Binding Name}" Margin="2" Initialized="BindObject"/>
		</HierarchicalDataTemplate>
		<HierarchicalDataTemplate DataType="{x:Type clr:AXmlAttribute}">
			<StackPanel Orientation="Horizontal" Margin="2">
				<TextBlock Text="{Binding Name}" Foreground="Blue" Initialized="BindObject"/>
				<TextBlock Text="=" VerticalAlignment="Center"/>
				<TextBlock Text="{Binding Value}" Foreground="Blue" Initialized="BindObject"/>
			</StackPanel>
		</HierarchicalDataTemplate>
		<HierarchicalDataTemplate DataType="{x:Type clr:AXmlText}" ItemContainerStyle="{x:Null}">
			<Border BorderBrush="LightGray" Height="1" BorderThickness="1"/>
		</HierarchicalDataTemplate>
	</Window.Resources>
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="2*"/>
			<ColumnDefinition Width="*"/>
		</Grid.ColumnDefinitions>
		<DockPanel Grid.Column="0">
			<TextBlock DockPanel.Dock="Top" Name="errorText" Margin="2" Background="WhiteSmoke"/>
			<ic:TextEditor x:Name="editor"/>
		</DockPanel>
		<DockPanel Grid.Column="1">
			<Button DockPanel.Dock="Top" Content="Parse" Click="Button_Click"/>
			<TreeView  Name="treeView"/>
		</DockPanel>
	</Grid>
</Window>